package models

import (
	"github.com/EDDYCJY/go-gin-example/pkg/e"
)

type SubmitWhiteRecord struct {
	ID         uint64 `gorm:"column:id" json:"id"`
	UserName   string `gorm:"column:user_name" json:"user_name"`
	UpdateTime DbTime `gorm:"column:update_time" json:"update_time"`
}

func (SubmitWhiteRecord) TableName() string {
	return "submit_white"
}

func GetWhiteUserByUserName(userName string) (*SubmitWhiteRecord, e.FResult) {
	var data SubmitWhiteRecord
	err := db.Model(&data).Debug().Where("user_name=? ", userName).First(&data).Error
	if err != nil {
		return nil, e.FResult{ErrCode: e.ERROR, ErrMsg: "用户不存在"}
	}
	return &data, e.FResult_OK
}
